<extend name='layout:index'/>
<block name='content'>
<body>
 



    <div class="wrapper wrapper-content animated fadeInRight">
      <div class="row">
      <div class="tabs-container">
		   <ul class="nav nav-tabs text-center">
		       <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" id="a_one" onclick="f1()" style="width:300px;background-color:white;"> 出售E积分</a>
		       </li>
		       <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false" id="a_two" onclick="f2()" style="width:300px;">出售E积分记录</a>
		       </li>
		   </ul>
      <div class="tab-content">
       <div id="tab-1" class="tab-pane active">
           <div class="panel-body">
           <div class="col-sm-6">
			  <div class="ibox float-e-margins">
			      <div class="ibox-content">
			      
			          	<div style="margin-left:0px;"><span style="font-size:1.3em">当前E积分价格：</span><span style="font-size:22px;color:red;">${$res.param1}</span></div>
			         
			           	<div style="margin-left:0px;"><span style="font-size:1.3em"> E积分交易量达 ：</span><span style="color:red;font-size:1.4em">{$res.param8_1}</span>时，</div><div style="margin-left:0px;"><span style="font-size:1.3em">价格上涨：</span><span style="color:red;font-size:22px">${$res.param8_2}</span></div>
			   
			       </div>
			   </div>
			</div>
			<div class="col-sm-6">
			  <div class="ibox float-e-margins">
			      <div class="ibox-content">
			      	<div><span style="font-size:1.3em;color:blue;">当前市值：{$user['option_num']*$res['param1']}</span></div>
	            	<p></p>
	            	<div><span style="font-size:1.3em">当前E积分总数 ：{$user.option_num}</span></div>
	            	<p></p>
	            	<div><span style="font-size:1.3em">历史E积分出售总数：{$user.option_num2}</span></div>
			      	
			       </div>
			   </div>
			</div>
			<div class="col-sm-6">
			<div class="ibox float-e-margins">
	            <div class="ibox-content">
	            	<div><span style="font-size:1.3em">本轮E积分总数：{$res.nowetotal}</span></div>
	            	<p></p>
	            	<div><span style="font-size:1.3em">剩余E积分总数：{$res.sys}</span></div>
	            	<p></p>
	            	<div><span style="font-size:1.3em">今日E积分交易数：{$res.jys}</span></div>
				</div>
			</div>
			</div>
			
            	
           <div class="col-sm-6">
            <div class="ibox-content">
           		<div class="table-responsive">
					<table class="table">
					<!--a data-toggle="modal" data-target="#myModal">[全屏]</a>-->
			    <div id="main" style="width: 500px;height:265px;" class=" J_iframe"></div>
			    <input type="hidden" value={$qdata} id="qdata">
                        <!-- <div class="echarts" id="echarts-line-chart"></div> -->
		    </div>	
				</table>
				</div>
				</div>
			</div>
			<div class="col-sm-12">
            <div class="ibox-content">
            
                <if condition="($res.txsjstart neq 0) and ($res.txsjend neq 0) and ($_SESSION['users']['user_money3'].user_money3 gt 0)">
           		<div style="color:red;text-align: center;font-size:1.3em">提示：您的认购积分将于{$res.txsjstart}~{$res.txsjend}个工作日匹配成功，具体时间以平台实际匹配时间为准！</div>
			
			</if>
			
						</div>




		<div class="col-sm-12">
			  <div class="ibox float-e-margins">
			     <!-- <div class="ibox-content">-->
			          <form class="form-horizontal m-t"  action="__MODULE__/sell/sellejf" method="post" onSubmit='return checkForm(this)' >
			             <div class="form-group">
			                  <label class="col-sm-3 " style="width:320px;">请输入出售数量<span style="color:red;letter-spacing:0px;font-size:12px;">(每个价位最多卖出总数量的{$res.param13}%)</span></label>
			               
			                  <div class="col-sm-8">
		                          <input id="sell_num" name="sell_num" class="form-control" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" type="text">
		                      	  <input name="maxsell" value="{$res.maxsell}" type="hidden">
		                      	  <input name="param1" value="{$res.param1}" type="hidden">
		                      	  <input name="sell_option_num" value="{$user.sell_option_num}" type="hidden">
		                      </div>
		                       <div class="col-sm-8">
		                       <span style="color:red;font-size:12px;marign-left:20px">E积分上涨大于等于${$res.maxsell}不能出售</span>
	              		</div>
	              		 </div>
	              	<div class="form-group">
	                  <label class="col-sm-3" style="width:320px">*手机验证码：</label>
	                  <div class="col-sm-8" >
	                  		<div class="input-group">
                                <input id="mobile_code" name="mobile_code" class="form-control" type="text"> 
                                <span class="input-group-btn"> 
                                	<input id="btnSendCode" class="btn btn-primary" value="获取手机验证码" onclick="sendMessage()" type="button" /> 
                                </span>
                            </div>
	                  </div>
	              </div>




	              		<div class="form-group">
			                  <label class="col-sm-3 " style="width:320px;">请输入安全密码</label>

			                  <div class="col-sm-8">
		                          <input id="repassword" name="repassword" class="form-control" type="password">

		                     </div>
		                     
	              		</div>
	              		 <!--<div class="form-group">-->
			                  <span style="color:red;marign-left:20px">当前可卖出的数量为：{$user['sell_option_num']}，最少卖出的数量为1</span>
	              		<!-- </div>-->
	              		<!--<div class="form-group">
                        <div class="col-sm-12 " style="margin-top:30px">-->
                            <input class="btn" style="background-color: #378cbe;color:white;width: 90%;height: 40px" value="出售提交"  type="submit">
                        <!--</div>
                    </div>-->
			           </form>
			     <!-- </div>-->
			   </div>
			</div>


			</div>
			
            </div>
        </div>
        <div id="tab-2" class="tab-pane">
            <div class="panel-body">
            <div class="col-sm-12">
			  <div class="ibox float-e-margins">
			    <div class="ibox-content">
            	<form class="form-horizontal m-t" name="aqmmform">
	              		<div class="table-responsive">
							<table class="table table-bordered table-striped table-hover">
								<thead>
									<tr>
										<th>日期</th>
										<th>会员ID</th>
										<th>数量</th>
										<th>交易类型</th>
										<th>单价</th>
										<th>总额</th>
										<th>当前状态</th>
										<th>操作</th>
									</tr>
									</thead>
									<tbody>
									<foreach name='sellEpoint' item='vo'>
							 		<tr>
										<td><?php echo date('Y-m-d H:i:s',$vo['sell_time']); ?></td>
										<td>{$vo['sell_user_id']}</td>
										<td>{$vo['sell_num']}</td>
										<td>{$vo['content']}</td>
										<td>{$vo['sell_money']}</td>
										<td>{$vo['sell_money']*$vo['sell_num']}</td>
										<if condition="$vo.status eq 0">
											<td>未匹配</td>
										
										<elseif condition="$vo.status eq 3"/>
											<td>交易成功</td>
										<elseif condition="$vo.status eq 7"/>
											<td>已撤销</td>
										
										</if>
										<td>
											<if condition='$vo.status eq 0'>
											<a href='__MODULE__/sell/cancelEpoint/id/{$vo.mk_id}/num/{$vo.sell_num}'>撤销</a></td>
											<else/>
											</if>
									</tr>
									</foreach>
                                    </tbody>
							</table>
							</div>
							<div class="">



 <div id="pager">
  <span style="margin-right:10px;">总计 <b>0</b>  个记录</span>
      
      </div>



<script type="Text/Javascript" language="JavaScript">
&lt;!--

function selectPage(sel)
{
  sel.form.submit();
}

//--&gt;
</script>
</div></form>
	             
	           </div>
	           </div>
	           </div>
            </div>
        </div>
   </div>
   </div>
</div>
    </div>
    <script src="themes/default/js/jquery.min.js?v=2.1.4"></script>
    <script src="themes/default/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="themes/default/js/content.min.js?v=1.0.0"></script><div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" style="width: 100%">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
      </div>
      <div class="modal-body">
        <div class="table-responsive">
	  <iframe class=" J_iframe" id="mainiframe" name="iframe0" src="?act=1" data-id="?act=qqmc" seamless="" frameborder="0" height="100%" width="100%"></iframe><table class="table ">
		      
 		</table>
	</div>
      </div>
    </div>
  </div>
</div>
    <script src="__PUBLIC__/home/js/plugins/layer/layer.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/home/js/mui.min.js"></script>
     <script src="__PUBLIC__/home/js/echarts.common1.min.js"></script>
    	<script>    	
    		// x轴的刻度  == 数学上的x轴
    		var xzhou = {$tdata};
    		// 数据 == 数学上的x轴上对应的数值
    		var data = {$qdata}
    		// 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById('main'));

            // 指定图表的配置项和数据
            option = {
    		    tooltip: {
    		        trigger: 'axis'
    		    },
    		    toolbox: {
    		        show: true,
    		        feature: {
    		            dataZoom: {
    		                yAxisIndex: 'none'
    		            },
    		            dataView: {readOnly: false}
    		        }
    		    },
    		    xAxis:  {
    		        type: 'category',
    		        boundaryGap: false,
    		        scale: true,
    		        data: xzhou,

    		    },
    		    yAxis: {
    		        type: 'value',
    				min:"0.2",
    				max:"0.4",
    				splitNumber:9,
    		    },
    		    dataZoom: [
    		        {
    		            id: 'dataZoomX',
    		            type: 'slider',
    		            xAxisIndex: [0],
    		            filterMode: 'filter'
    		        }
    		    ],
    		    series: [
    		        {
    		            name:'指数',
    		            type:'line',
    		            data:data,
    		            markPoint: {
    		                data: [
    		                    {type: 'max', name: '最大值'},
    		                    {type: 'min', name: '最小值'}
    		                ]
    		            }
    		        }
    		    ]
    		};


            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);
    	</script>
		<script>
			var className = document.getElementsByClassName('link');
			for(var i = 0; i < className.length; i++) {
				className[i].addEventListener('tap', function() {
					var href = $(this).attr("name");
					layer.ready(function() {
						layer.open({
							type: 2,
							title: 'layer弹层组件',
							fix: false,
							shadeClose: true,
							maxmin: true,
							area: ['100%', '100%'],
							content: href
						});
					});
				})
			}
    	</script>
		<script>
			var className = document.getElementsByClassName('link');
			for(var i = 0; i &lt; className.length; i++) {
				className[i].addEventListener('tap', function() {
					var href = $(this).attr("name");
					layer.ready(function() {
						layer.open({
							type: 2,
							title: 'layer弹层组件',
							fix: false,
							shadeClose: true,
							maxmin: true,
							area: ['100%', '100%'],
							content: href
						});
					});
				})
			}
		</script>
 
    <script>
    	$('.bnt').click(function(){
    		var num = $('#sell_num').val();
    		
    	});

 //下面的是发送手机验证码
var InterValObj; //timer变量，控制时间
var count = 30; //间隔函数，1秒执行
var curCount;//当前剩余秒数

function sendMessage() {
    curCount = count;       
       
    //向后台发送处理数据
         $.ajax({
                    type : 'POST',
                    url : '/home/sell/phoneAjax',
                    data : {code:1},
                    dataType : 'html',
                    async : false,
                    success : function(str){                       
                         if(str == '发送成功'){                            
                            //设置button效果，开始计时
                            $("#btnSendCode").attr("disabled", "true");
                            $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");
                            InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
                        }else{
                               var txt=  "信息错误,请核对后再添";
                               window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.info);
                        }                        
                    }
                
                })
   
}
//timer处理函数
function SetRemainTime() {
    if (curCount == 0) {                
        window.clearInterval(InterValObj);//停止计时器
        $("#btnSendCode").removeAttr("disabled");//启用按钮
        $("#btnSendCode").val("重新发送验证码");
        code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效    
    }else {
        curCount--;
        $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");
    }
}

function checkForm(){
	$('.btn').attr('disabled',true);
	if($('#mobile_code').val() == ''){
		 var txt=  "验 证 码 不 能 为 空";
         window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
         return false;
	}else{
		return true;
	}
 
}
 </script>


</body>
</block>